﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;
using JKF.DataModule.IDAL;
using JKF.Substructure;
using System.Data.SqlClient;//请先添加引用

namespace JKF.DataModule.SqlServerDAL
{
    public partial class dalSYS_PARAM_VALUE : IdalSYS_PARAM_VALUE
    {
        /// <summary>
        /// 返回销售数据锁定天数,-1没有找到数据
        /// </summary>
        /// <returns></returns>
        public static int GetSalesDataLockDays()
        {
            var sql = "select val from sys_param_value where param_key='SALES_DATA_LOCK'";
            var data = DB.HR.ExecuteDataSet(CommandType.Text, sql).Tables[0];
            var vl = -1;
            if (data != null && data.Rows.Count > 0)
            {
                int.TryParse(data.Rows[0][0].ToString(), out vl);
                if (vl < 0) vl = -1;
            }
            return vl;
        }
    }
}
